(*
	videoFramesPerSecond fr - Set the playing speed for the next playVideo command.

	To compile and link this file using Macintosh Programmer's Workshop,

		pascal -w videoFramesPerSecond.p

		link -m ENTRYPOINT -o HyperCommands -rt XCMD=8010 -sn Main=videoFramesPerSecond ¶
			videoFramesPerSecond.p.o "{MPW}"Libraries:interface.o "{MPW}"PLibraries:PasLib.o

	Copyright © 1988 Apple Computer, Inc.

	2/88 - Initial coding by Harry R. Chesley.
*)

{$R-}

{$S videoFramesPerSecond } 	{ Segment name must be the same as the command name. }

unit DummyUnit;

interface

uses MemTypes, QuickDraw, OSIntf, HyperXCmd;

procedure EntryPoint(paramPtr: XCmdPtr);
	
implementation

type

Str31 = String[31];

procedure videoFramesPerSecond(paramPtr: XCmdPtr); forward;

procedure EntryPoint(paramPtr: XCmdPtr);

	begin
		videoFramesPerSecond(paramPtr);
	end;

procedure videoFramesPerSecond(paramPtr: XCmdPtr);

	var speed: str255;

	{$I XCmdGlue.inc}

	procedure Fail(errMsg: Str255); { set theResult and quit }
		begin
			paramPtr^.returnValue := PasToZero(errMsg);
			exit(videoFramesPerSecond);
		end;

	{$I VideoUtil.inc}

	begin
		if paramPtr^.paramCount <> 1 then Fail('parameter count is not 1');

		GetStrParm(1,speed);

		{ Set the defaults. }
		if StringEqual(speed,'slowest') then speed := '1'
		else if StringEqual(speed,'slower') then speed := '10'
		else if StringEqual(speed,'slow') then speed := '15'
		else if StringEqual(speed,'normal') then speed := '30'
		else if StringEqual(speed,'fast') then speed := '60'
		else if StringEqual(speed,'faster') then speed := '90'
		else if StringEqual(speed,'fastest') then speed := '120';

		{ Set the global that specifies the speed. }
		SetStrGlobal('videoSpeed',speed);

		{ Now let the play change all this if it wants to. }
		GetStrParm(1,speed);
		videoCmd('fps',speed);
	end;

end.
